<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>商品介绍</title>
    <link type="text/css" rel="stylesheet" href="/Public/Home/css/reset.css">
    <link type="text/css" rel="stylesheet" href="/Public/Home/css/main.css">
    <script src="/Public/Home/js/jquery.min.js"></script>
    <style>
        .dropdown{
            display: inline-block;
            position: relative;
        }
        .dropdown-content{
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            color: #000;
            padding: 12px 16px;

        }
        .dropdown:hover .dropdown-content{
            display: block;
        }

    </style>
</head>

<body class="grey">
<div class="headerBar">
    <div class="topBar">
        <div class="comWidth">
            <div class="rightArea">
                欢迎来到电子商城！
                <?php if(empty($_SESSION['uname'])): ?><a href="<?php echo U('User/login');?>">[登录]</a><a href="<?php echo U('reg');?>">[免费注册]</a>
                    <?php else: ?>
                    <span>欢迎您,</span><div class="dropdown">
                    <a href="#"><?php echo (session('uname')); ?> </a>
                    <div class="dropdown-content">
                        <a href="/index.php/Home/Index/myOrder/id/<?php echo (session('uid')); ?>">我的订单</a>
                        <a href="/index.php/Home/Index/changePwd/uname/<?php echo (session('uname')); ?>">修改密码</a>
                    </div>
                </div>
                    <a href="<?php echo U('User/logout');?>">[退出]</a><?php endif; ?>
            </div>
        </div>
    </div>
    <div class="logoBar">
        <div class="comWidth">
            <div class="search_box fl">
                <input type="text" class="search_text fl">
                <input type="button" value="搜 索" class="search_btn fr">
            </div>
            <div class="shopCar fr">
                <span class="shopText fl">购物车</span>
                <span class="shopNum fl">0</span>
            </div>
        </div>
    </div>
    <div class="navBox">
        <div class="comWidth clearfix">
            <div class="shopClass fl">
                <h3>全部商品分类<i class="shopClass_icon"></i></h3>
                <div class="shopClass_show hide">
                    <dl class="shopClass_item">
                        <dt><a href="#" class="b">手机</a> <a href="#" class="b">数码</a> <a href="#" class="aLink">合约机</a></dt>
                        <dd><a href="#">荣耀3X</a> <a href="#">单反</a> <a href="#">智能设备</a></dd>
                    </dl>
                    <dl class="shopClass_item">
                        <dt><a href="#" class="b">手机</a> <a href="#" class="b">数码</a> <a href="#" class="aLink">合约机</a></dt>
                        <dd><a href="#">荣耀3X</a> <a href="#">单反</a> <a href="#">智能设备</a></dd>
                    </dl>
                    <dl class="shopClass_item">
                        <dt><a href="#" class="b">手机</a> <a href="#" class="b">数码</a> <a href="#" class="aLink">合约机</a></dt>
                        <dd><a href="#">荣耀3X</a> <a href="#">单反</a> <a href="#">智能设备</a></dd>
                    </dl>
                    <dl class="shopClass_item">
                        <dt><a href="#" class="b">手机</a> <a href="#" class="b">数码</a> <a href="#" class="aLink">合约机</a></dt>
                        <dd><a href="#">荣耀3X</a> <a href="#">单反</a> <a href="#">智能设备</a></dd>
                    </dl>
                    <dl class="shopClass_item">
                        <dt><a href="#" class="b">手机</a> <a href="#" class="b">数码</a> <a href="#" class="aLink">合约机</a></dt>
                        <dd><a href="#">荣耀3X</a> <a href="#">单反</a> <a href="#">智能设备</a></dd>
                    </dl>
                </div>
            </div>
            <ul class="nav fl">
                <li><a href="#" class="active">数码城</a></li>
                <li><a href="#">团购</a></li>
                <li><a href="#">发现</a></li>
                <li><a href="#">二手特卖</a></li>
                <li><a href="#">名品会</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="userPosition comWidth">
    <strong><a href="#">首页</a></strong>
    <span>&nbsp;&gt;&nbsp;</span>
    <a href="#"><?php echo ($cate); ?></a>
    <span>&nbsp;&gt;&nbsp;</span>
    <em><?php echo ($data["ghh"]); ?></em>
</div>
<div class="description_info comWidth">
    <div class="description clearfix">
        <div class="leftArea">
            <div class="description_imgs">
                <div class="big">
                    <a href="#" class="jqzoom"  title="triumph" >
                        <img width="309" height="340" src="<?php echo ($data["gimg"]); ?>"  title="triumph">
                    </a>
                </div>
            </div>
        </div>
        <div class="rightArea">
            <div class="des_content">
                <h3 class="des_content_tit"><?php echo ($data["gname"]); ?></h3>
                <div class="dl clearfix">
                    <div class="dt">市场价</div>
                    <div class="dd clearfix"><span class="des_money" style="color: #ccc"><em>￥</em><del><?php echo ($data["gscj"]); ?></del></span></div>
                </div>
                <div class="dl clearfix">
                    <div class="dt">商城价</div>
                    <div class="dd clearfix"><span class="des_money"><em>￥</em><?php echo ($data["gwzj"]); ?></span></div>
                </div>
                <div class="dl clearfix">
                    <div class="dt">商品描述</div>
                    <div class="dd clearfix"><span class="hg"><?php echo ($data["gdesc"]); ?></span></div>
                </div>
                <div class="dl clearfix">
                    <div class="dt">库存</div>
                    <div class="dd clearfix"><span class="hg"><?php echo ($data["gnum"]); ?>(件)</span></div>
                </div>
                <div class="des_position">

                    <div class="dl">
                        <div class="dt des_num">数量</div>
                        <div class="dd clearfix">
                            <div class="des_number">
                                <a href="#" title="减1"><div class="reduction" id="min">-</div></a>

                                <div class="des_input">
                                    <input type="text" value="1" id="text_box">
                                </div>
                               <a href="#" title="加1"><div class="plus" id="add">+</div></a>
                            </div>

                        </div>
                    </div>
                </div>

                <div class="shop_buy" >
                   <a href="javascript:;" class="purchase" data-gname="<?php echo ($data["gname"]); ?>"
                      data-price="<?php echo ($data["gwzj"]); ?>" data-state="<?php echo (session('uname')); ?>"
                      target="_blank"><button class="gy" style="cursor:pointer;">立即购买</button></a>
                    <button class="gy" style="cursor:pointer;">加入购物车</button>
                </div>
                <div class="notes">
                    注意：此商品可提供普通发票，不提供增值税发票。
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $(function(){
        var t = $("#text_box");
        $("#add").click(function(){
            t.val(parseInt(t.val())+1);

        })
        $("#min").click(function(){
            if (parseInt(t.val())>1) {                     //判断数量值大于1时才可以减少
                t.val(parseInt(t.val())-1)
            }

        })
        $(".purchase").on('click',function () {
            var state=$(this).attr('data-state');
                if(state==null || state==''){
                    if(confirm('你还没有登录，现在是否去登录？')){
                        window.location.href="<?php echo U('User/login');?>";
                    }
                }else{
                    var gname=$(this).attr('data-gname');
                    var gwzj=$(this).attr('data-price');
                    var number=$('#text_box').val();
                    window.location.href="/index.php/Home/Index/order/gname/"+gname+"/gwzj/"+gwzj+"/number/"+number;
                }
            
        })

    })

</script>
<div class="hr_25"></div>
<div class="footer">
    <p><a href="#">商城简介</a><i>|</i><a href="#">商城公告</a><i>|</i> <a href="#">招纳贤士</a><i>|</i><a href="#">联系我们</a><i>|</i>客服热线：400-675-1234</p>
    <p>Copyright &copy; 2006 - 2018 版权所有&nbsp;&nbsp;&nbsp;渝ICP备09037834号&nbsp;&nbsp;&nbsp;渝ICP证B1034-8373号&nbsp;&nbsp;&nbsp;某市公安局XX分局备案编号：123456789123</p>
    <p class="web"><a href="#"><img src="/Public/Home/image/webLogo.jpg" alt="logo"></a><a href="#"><img src="/Public/Home/image/webLogo.jpg" alt="logo"></a><a href="#"><img src="/Public/Home/image/webLogo.jpg" alt="logo"></a><a href="#"><img src="/Public/Home/image/webLogo.jpg" alt="logo"></a></p>
</div>

</body>
</html>